// import { Canceler } from 'axios';
import { pget, ppostJson } from '@/utils/req';
import { modalApi } from '@/utils/modalReq';
// 获取菜单列表
export function getMenuList() {
  return pget(`${modalApi.system}/common/permission/list`);
}

// 新增菜单
export function addMenu(data: any) {
  return ppostJson(`${modalApi.system}/permission/create`, data);
}

// 修改菜单
export function editMenu(permissionId: string, data: any) {
  return ppostJson(
    `${modalApi.system}/permission/update/${permissionId}`,
    data,
  );
}

// 删除菜单
export function deleteMenu(permissionId: string) {
  return ppostJson(`${modalApi.system}/permission/delete/${permissionId}`);
}

// 查看菜单
export function viewMenu(permissionId: string) {
  return pget(`${modalApi.system}/permission/info/${permissionId}`);
}

// 获取登录用户拥有的权限列表
export function getUserMenu() {
  return pget(`${modalApi.system}/login-user/permission/list`);
}
